<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>sticky-list-titles</title>
    <style>
        .container {
            display: grid;
            place-items: center;
            min-height: 400px;
        }
        .sticky-stack {
            background-color: #2396ef;
            color: #fff;
            margin: 0;
            height: 320px;
            border-radius: 1rem;
            overflow-y: auto;
        }
        .sticky-stack dt {
            position: sticky;
            top: 0;
            font-weight: bold;
            color: #cfd8dc;
            background-color: #263238;
            padding: .25rem 1rem;
        }
        .sticky-stack dd {
            margin: 0;
            padding: 0.75rem 1rem;
        }
        .sticky-stack dd + dt {
            margin-top: 1rem;
        }
        ::-webkit-scrollbar {
            background-color: #444444;
            width: 5px;
            height: 5px;
        }
        ::-webkit-scrollbar-thumb {
            width: 5px;
            height: 5px;
            background-color: #9c60fc;
        }
    </style>
</head>

<body>
    <div class="container">
        <dl class="sticky-stack">
            <dt>A</dt>
            <dd>Algeria</dd>
            <dd>Angola</dd>

            <dt>B</dt>
            <dd>Benin</dd>
            <dd>Botswana</dd>
            <dd>Burkina Faso</dd>
            <dd>Burundi</dd>

            <dt>C</dt>
            <dd>Cabo Verde</dd>
            <dd>Cameroon</dd>
            <dd>Central African Republic</dd>
            <dd>Chad</dd>
            <dd>Comoros</dd>
            <dd>Congo, Democratic Republic of the</dd>
            <dd>Congo, Republic of the</dd>
            <dd>Cote d'Ivoire</dd>

            <dt>D</dt>
            <dd>Djibouti</dd>

            <dt>E</dt>
            <dd>Egypt</dd>
            <dd>Equatorial Guinea</dd>
            <dd>Eritrea</dd>
            <dd>Eswatini (formerly Swaziland)</dd>
            <dd>Ethiopia</dd>
        </dl>
    </div>
</body>

</html>